package com.lengxf.mqtt.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;


/**
 * 线程池配置
 *
 * @Author Lengxf
 */
@Configuration
public class ThreadPoolConfiguration {

    @Bean
    public Executor threadPool() {
        return new ThreadPoolExecutor(10, 20, 60,
                TimeUnit.SECONDS, new LinkedBlockingQueue<>(1000),
                Executors.defaultThreadFactory(), new ThreadPoolExecutor.DiscardOldestPolicy());
    }

}
